//
//  CImageHelper.m
//  collection
//
//  Created by 张靖 on 11-10-31.
//  Copyright (c) 2011年 collection. Inc.. All rights reserved.
//

#import "CImageHelper.h"

@implementation CImageHelper

+ (UIImage*) getImage:(CGSize)imageSize withColor:(UIColor*)color
{
	NSAssert(color != nil, @"参数错误");
	
	UIImage* image = nil;
	if ([[UIDevice currentDevice].systemVersion doubleValue] >= 4.0)
	{
		UIGraphicsBeginImageContextWithOptions(imageSize, NO, [UIScreen mainScreen].scale);
	}
	else 
	{
		UIGraphicsBeginImageContext(imageSize);
	}
	[color set];
	UIRectFill(CGRectMake(0, 0, imageSize.width, imageSize.height));
	image = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();
	return image;
}

@end
